package com.zmn.oms.zmn.business.interfaces.work.orderpay;

import com.zmn.oms.common.dro.orderpay.OrderPayResultDRO;
import com.zmn.oms.common.dto.OmsOperator;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.bo.refund.RefundInitiateBO;
import com.zmn.oms.model.dto.work.modify.must.ZsOrderPayDTO;
import com.zmn.oms.model.dto.work.refund.RefundDTO;
import com.zmn.oms.model.entity.discount.OrderDiscount;
import com.zmn.oms.model.entity.pay.OrderPay;
import com.zmn.oms.model.entity.work.OrderWork;
import com.zmn.pay.gateway.common.model.dro.PayGatewayDRO;
import com.zmn.pay.gateway.common.model.dro.RefundDRO;

import java.util.List;

/**
 * 类描述：啄木鸟工单支付
 *
 * @author heciqi
 * @date 2019/1/8 21:14
 */
public interface ZsOrderPayBService {

    /**
     * 支付工程师收款
     *
     * @param orderPayDTO
     * @return
     * @throws OmsBaseException
     */
	com.zmn.pay.gateway.common.model.dro.PayGatewayDRO payMasterAmount(ZsOrderPayDTO orderPayDTO) throws OmsBaseException;

    /**
     * 渠道二次支付
     *
     * @param orderPayDTO
     * @throws OmsBaseException
     */
    void paySecondChannelPay(ZsOrderPayDTO orderPayDTO) throws OmsBaseException;

    /**
     * 渠道二次支付，并将工单状态置为成功
     *
     * @param orderPayDTO
     * @throws OmsBaseException
     */
    void paySecondChannelPayAndOrderComplete(ZsOrderPayDTO orderPayDTO) throws OmsBaseException;

	com.zmn.pay.gateway.common.model.dro.PayGatewayDRO payPrepaidAmount(ZsOrderPayDTO orderPayDTO) throws OmsBaseException;

	/**
	 * 支付定金
	 *
	 * @param orderPayDTO
	 * @return
	 * @throws OmsBaseException
	 */
	com.zmn.pay.gateway.common.model.dro.PayGatewayDRO payDepositAmount(ZsOrderPayDTO orderPayDTO) throws OmsBaseException;

	/**
	 * 多次上门支付定金
	 *
	 * @param orderPayDTO
	 * @return
	 * @throws OmsBaseException
	 */
	com.zmn.pay.gateway.common.model.dro.PayGatewayDRO multipleVisitPayDepositAmount(ZsOrderPayDTO orderPayDTO) throws OmsBaseException;

	/**
	 * 支付进度款
	 *
	 * @param orderPayDTO
	 * @return
	 * @throws OmsBaseException
	 */
	com.zmn.pay.gateway.common.model.dro.PayGatewayDRO progressPayAmount(ZsOrderPayDTO orderPayDTO) throws OmsBaseException;

    /**
     * 支付优惠金额
     *
     * @param orderWork
     * @return
     */
    com.zmn.pay.gateway.common.model.dro.PayGatewayDRO payDiscountAmount(OrderWork orderWork);

	/**
	 * 支付优惠金额
	 * @param plat
	 * @param orderId
	 * @param workId
	 * @param syncFlag
	 * @param discountList
	 * @return
	 */
	com.zmn.pay.gateway.common.model.dro.PayGatewayDRO payDiscountAmount(Integer plat, Long orderId, Long workId, Integer syncFlag, List<OrderDiscount> discountList);

    /**
     * 支付渠道预付
     *
     * @param orderWork
     * @return
     */
	PayGatewayDRO payChannelPrepaidAmount(OrderWork orderWork) throws OmsBaseException;

    /**
     * 支付退款金额
     *
     * @return PayGatewayDRO
     */
	RefundDRO payRefundAmount(RefundInitiateBO refundInitiateBO) throws OmsBaseException;

    /**
     * 获取公众号临时二维码
     * @param orderId
     * @param qrCodeType
     * @param operator
     * @return
     */
    String getWechatQrcode(Long orderId,String qrCodeType,String operator);

    /**
     * 获取公众号临时二维码
     * @param orderId
     * @param qrCodeType
     * @return
     */
    String getWechatQrcode(Long orderId, Integer qrCodeType);

	/**
	 * 获取公众号临时二维码
	 * @param orderWork
	 * @param qrCodeType
	 * @return
	 */
	String getWechatQrcode(OrderWork orderWork, Integer qrCodeType);

    /**
     * 获取支付标识
     *
     * @param orderWork
     * @return
     * 0 不需要支付，1 需要支付，2 已支付（已完成）,3 提示支付
     */
	int getPayFlag(OrderWork orderWork);

	/**
	 * 获取第三方渠道的支付二维码链接，如果订单不支持第三方二维码支付，返回null。
	 * @param orderWork
	 * @param payChannelId
	 * @return
	 * @throws OmsBaseException
	 */
	com.zmn.pay.gateway.common.model.dro.PayGatewayDRO getChannelPayQrCode(OrderWork orderWork, Integer payChannelId) throws OmsBaseException;

	/**
	 * 校验渠道订单配置
	 *
	 * @param version
	 * @param orderWork
	 * @return
	 * @throws OmsBaseException
	 */
	void checkChannelOrderConfig(Integer version,OrderWork orderWork) throws OmsBaseException;

	/**
	 * 订单取消后收到支付回调，退款补偿
	 * @param resultDRO
	 * @return
	 * @throws OmsBaseException
	 */
	void compensateRefund(OrderPayResultDRO resultDRO) throws OmsBaseException;

	/**
	 *
	 * 次卡订单退款
	 * @param orderWork
	 * @param originalOrderWork
	 * @throws OmsBaseException
	 */
	void timesCardRefund(OrderWork orderWork, RefundDTO refundDTO) throws OmsBaseException;

	/**
	 *
	 * 次卡订单退款
	 * @param orderId
	 * @param workId
	 * @param timesCardCoupCode
	 * @param RefundAmount
	 * @throws OmsBaseException
	 */
	void timesCardRefund(Long orderId, Long workId, String timesCardCoupCode, Integer RefundAmount, Integer refundType, OmsOperator operator) throws OmsBaseException;

}
